<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>index</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<form id="form1" name="myForm">
    <table align="center">
        <caption>用户注册</caption>
        <tr>
            <td>博客信息：</td>
            <td>
                <label>您好，欢迎访问 pan_junbiao的博客</label>
            </td>
        </tr>
        <tr>
            <td>博客地址：</td>
            <td>
                <label>https://blog.csdn.net/pan_junbiao</label>
            </td>
        </tr>
        <tr>
            <td>登录账户：</td>
            <td>
                <input type="text" name="username" />
            </td>
        </tr>
        <tr>
            <td>登录密码：</td>
            <td>
                <input type="password" name="password" />
            </td>
        </tr>
        <!-- 以下是提交、取消按钮 -->
        <tr>
            <td colspan="2" style="text-align: center; padding: 5px;">
                <input type="button" value="提交" onclick="submitFrom()"/>
                <input type="button" value="重置" onclick="resetFrom()"/>
            </td>
        </tr>
    </table>
</form>
<script>
    //提交
    function submitFrom()
    {
        //验证数据
        if(!myForm.username.value)
        {
            alert("请输入登录账户！");
            myForm.username.focus();
            return;
        }

        if(!myForm.password.value)
        {
            alert("请输入登录密码！");
            myForm.password.focus();
            return;
        }

        //提交表单
        myForm.method = 'POST';
        myForm.action = "/xuegao/login";

        myForm.submit();
    }

    //重置
    function resetFrom()
    {
        //重置表单
        document.getElementsByName("myForm")[0].reset();
    }
</script>
</body>
</html>